package com.ruoyi.user.domain.vo.relation;

import com.ruoyi.common.core.domain.model.UserBusinessInfo;
import com.ruoyi.user.domain.vo.UserFamilyVo;
import com.ruoyi.user.domain.vo.UserHelpGroupVo;
import com.ruoyi.user.domain.vo.UserRelationVo;
import lombok.Builder;
import lombok.Data;

/**
 * Description:
 * Author: YangShiWei
 * Email: strongwalter2014@gmail.com
 * Datetime: 2023/4/9 17:40
 */
@Data
@Builder
public class RelationNode {

    private Long id;
    private String text;
    private String borderColor;
    private String color;
    private String fontColor;
    private int nodeShape;
    private int width;
    private int height;

    public static RelationNode buildFromUserDrug(UserBusinessInfo drugInfo) {
        return RelationNode.builder()
            .id(drugInfo.getId())
            .text(drugInfo.getName())
            .borderColor("white")
            .color("#000080")
            .nodeShape(0)
            .build();
    }

    public static RelationNode buildFromUserMember(UserBusinessInfo memberInfo) {
        return RelationNode.builder()
            .id(memberInfo.getId())
            .text(memberInfo.getName())
            .borderColor("white")
            .color("black")
            .nodeShape(0)
            .build();

    }

    public static RelationNode buildFromUserFamily(UserFamilyVo vo) {
        return RelationNode.builder()
            .id(vo.getFamilyId())
            .text(vo.getName())
            .borderColor("white")
            .color("#E6A23C")
            .nodeShape(0)
            .build();
    }

    public static RelationNode buildFromUserHelpGroup(UserHelpGroupVo vo) {
        return RelationNode.builder()
            .id(vo.getHelpGroupId())
            .text(vo.getName())
            .borderColor("white")
            .color("#67C23A")
            .nodeShape(0)
            .build();
    }

    public static RelationNode buildFromUserRelation(UserRelationVo vo) {
        return RelationNode.builder()
            .id(vo.getRelationId())
            .text(vo.getName())
            .borderColor("white")
            .color("#9400D3")
            .build();
    }


}
